package com.wyh.cloud.feign.controller;

import com.wyh.cloud.feign.service.PaymentFeignService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import pojo.CommonResult;
import pojo.Payment;

import javax.annotation.Resource;
import java.util.concurrent.TimeUnit;

/**
 * @author wyh
 * @version 1.0
 * @date 2021/11/17 11:07
 */
@RestController
@Slf4j
public class OrderFeignController {

    @Resource
    private PaymentFeignService paymentFeignService;

    @GetMapping(value = "/consumer/payment/getPaymentById/{id}")
    CommonResult<Payment> getPaymentById(@PathVariable("id") Long id){
        return paymentFeignService.getPaymentById(id);
    }

    @PostMapping(value = "/consumer/payment/add")
    CommonResult<Payment> addPayment(@RequestBody Payment payment){
        return paymentFeignService.addPayment(payment);
    }

    @GetMapping("/consumer/payment/lb")
    public String lbPort(){
        return paymentFeignService.lbPort();
    }

    @GetMapping(value = "/consumer/payment/timeout")
    public String timeout(){
        return paymentFeignService.timeout();
    }
}
